package routes

import (
	"gin-mini-admin/controller"
	jwt "github.com/appleboy/gin-jwt/v2"
	"github.com/gin-gonic/gin"
)

// InitBaseRoutes 注册基础路由
func InitBaseRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gin.IRoutes {
	// 登录登出刷新token无需鉴权
	r.GET("ping", controller.Demo)
	r.GET("encryptpwd", controller.EncryptPasswd) // 生成加密密码
	r.GET("decryptpwd", controller.DecryptPasswd) // 密码解密为明文
	r.POST("/login", authMiddleware.LoginHandler)
	r.POST("/logout", authMiddleware.LogoutHandler)
	r.POST("/refreshToken", authMiddleware.RefreshHandler)
	return r
}
